StatefulSessionObjectReferenceImpl{
  this.viewServices=viewServices;
  final ServiceController<?> controller=currentServiceContainer().getRequiredService(createServiceName);
}
StatefulSessionObjectReferenceImpl{
  ejbComponent=(StatefulSessionComponent)controller.getValue();
  this.id=ejbComponent.createSession();
}
buildViews{
  final Map<String,ServiceName> viewServices=new HashMap<String,ServiceName>();
  final Map<String,Class<?>> views=new HashMap<String,Class<?>>();
  for (  BusinessInterfaceDescriptor<?> view : descriptor.getRemoteBusinessInterfaces()) {
    views.put(view.getInterface().getName(),view.getInterface());
  for (  BusinessInterfaceDescriptor<?> view : descriptor.getLocalBusinessInterfaces()) {
    views.put(view.getInterface().getName(),view.getInterface());
  for (  Map.Entry<Class<?>,ServiceName> entry : descriptor.getViewServices().entrySet()) {
    final Class<?> viewClass=entry.getKey();
    if (viewClass != null) {
      final Set<Class<?>> seen=new HashSet<Class<?>>();
      final Set<Class<?>> toProcess=new HashSet<Class<?>>();
      toProcess.add(viewClass);
      while (!toProcess.isEmpty()) {
        Iterator<Class<?>> it=toProcess.iterator();
        final Class<?> clazz=it.next();
        seen.add(clazz);
        viewServices.put(clazz.getName(),entry.getValue());
        final Class<?> superclass=clazz.getSuperclass();
        if (superclass != Object.class && superclass != null && !seen.contains(superclass)) {
          toProcess.add(superclass);
        for (        Class<?> iface : clazz.getInterfaces()) {
          if (!seen.contains(iface)) {
            toProcess.add(iface);
  return viewServices;
}
getBusinessObject{
  if (isRemoved()) {
    throw WeldMessages.MESSAGES.ejbHashBeenRemoved();
  if (viewServices.containsKey(businessInterfaceType.getName())) {
    final ServiceController<?> serviceController=currentServiceContainer().getRequiredService(viewServices.get(businessInterfaceType.getName()));
    final ComponentView view=(ComponentView)serviceController.getValue();
    try {
      return (S)view.createInstance(Collections.<Object,Object>singletonMap(SessionID.class,id)).getInstance();
 catch (    Exception e) {
      throw new RuntimeException(e);
 else {
    throw WeldMessages.MESSAGES.viewNotFoundOnEJB(businessInterfaceType.getName(),ejbComponent.getComponentName());
}
currentServiceContainer{
  return AccessController.doPrivileged(new PrivilegedAction<ServiceContainer>(){
      return CurrentServiceContainer.getServiceContainer();
}
run{
  return CurrentServiceContainer.getServiceContainer();
}
writeReplace{
  return new SerializedStatefulSessionObject(createServiceName,id,viewServices);
}
remove{
  if (!isRemoved()) {
    removed=true;
}
isRemoved{
    return !ejbComponent.getCache().contains(id);
  return true;
}
